//
//  WYCMessegeCell.m
//  51信用卡
//
//  Created by 中企互联 on 2017/11/2.
//  Copyright © 2017年 中企互联. All rights reserved.
//

#import "WYCMessegeCell.h"
#import "configuration.h"
@implementation WYCMessegeCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    WYCMessegeCell * cell = [tableView dequeueReusableCellWithIdentifier:[WYCMessegeCell ID]];
    //    cell.backgroundColor = [UIColor redColor];
    cell = [[WYCMessegeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[WYCMessegeCell ID]];
    
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setMember];
        
    }
    return self;
}
//cell控件摆放
- (void)setMember{
    //底部View
    UIView * messegeView = [[UIView alloc] init];
    messegeView.frame = CGRectMake(0, 0, ScreenWidth, 150 * px);
    [self.contentView addSubview:messegeView];
    
    
    //内容消息
    self.titlelabel = [[UILabel alloc] init];
    self.titlelabel.frame = CGRectMake( 40, 10, 200, 20);
    self.titlelabel.numberOfLines = 0;
    self.timelabel.textColor = [UIColor grayColor];
    self.titlelabel.font = [UIFont systemFontOfSize:15];
    [messegeView addSubview:self.titlelabel];
    
    
   self.round =[MyUIClass makeUIImageViewWithFrame:CGRectMake(10, 10, 15, 15) andImage:@"redmes"];
    [messegeView addSubview:self.round];
    //时间
    self.timelabel = [[UILabel alloc] init];
    self.timelabel.font = [UIFont systemFontOfSize:40 * px];
    self.timelabel.textColor = WYCRGBColor(159, 159, 159);
    self.timelabel.frame = CGRectMake(ScreenWidth-150, 10 , 150, 50 * px);
    [messegeView addSubview:self.timelabel];
    
}

- (void)setMessegeModel:(WYCMessegeModel *)messegeModel
{
    _messegeModel = messegeModel;
    //标题
    _titlelabel.text = messegeModel.title;
    //时间
    _timelabel.text = messegeModel.pushTime;
    
    if ([messegeModel.isRead isEqualToString:@"1"])
    {
        self.round.hidden = NO;
    }
    else
    {
        self.round.hidden = YES;
    }
    
    
}

+(NSString *)ID{
    return @"cell";
}

@end
